﻿namespace Chameleon.Storage
{
	using System.IO;

	/// <summary>
	/// Provides a representation of a storage item within a storage context.
	/// </summary>
	
	public interface IStorageItem
	{
		/// <summary>
		/// Stores the specified string content in the storage item.
		/// </summary>
		/// <param name="content">
		/// String content to store.
		/// <para>Content is assumed to be in UTF-8 encoding.</para>
		/// </param>
			
		void Put( string content );


		/// <summary>
		/// Stores the specified binary content in the storage item.
		/// </summary>
		/// <param name="content">Byte array of content to store.</param>

		void Put( byte[] content );


		/// <summary>
		/// Stores the specified stream content into the storage item.
		/// </summary>
		/// <param name="content">Stream containing content to store.</param>

		void Put( Stream content );


		/// <summary>
		/// Returns the item's contents as a string.
		/// </summary>

		string AsString();


		/// <summary>
		/// Returns the item's contents as a byte array.
		/// </summary>

		byte[] AsBytes();


		/// <summary>
		/// Puts the item's contents into a stream.
		/// </summary>
		/// <param name="target">Target stream into which the item's contents will be placed.</param>

		void AsStream( Stream target );
	}
}
